#include <iostream>

using namespace std;

int calc(int l, int r)
{
	int cnt = 0;
	for(int i = l; i <= r; i++)
	{
		int tmp = i;
		while(tmp)
		{
			if(tmp % 10 == 2) cnt++;
			tmp /= 10;
		}
	}
	return cnt;
}

int main()
{
	int l, r; cin >> l >> r;
	cout << calc(l, r) << endl;
	return 0;
} 